package com.lianyu507.controller;

import com.lianyu507.enums.ErrorTypeEnum;
import com.lianyu507.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/adminafter")
public class ManagerController extends BaseController {

    @Autowired
    private ManagerService managerService;


    @RequestMapping("/login")
    @ResponseBody
    public Map<String, Object> login(String managerName, String managerPassword) {
        try {

            managerService.afterLogin(managerName, managerPassword);

            return successResult(true);
        } catch (Exception e) {
            e.printStackTrace();
            return failedResult(ErrorTypeEnum.NOT_FOUND, e.getMessage());
        }
    }


}
